<template>
  <div>
    <el-tag
      v-if="renderField.prop === 'onlineStates'"
      :type="renderRow.onlineStates ? 'success' : 'info'"
      >{{ state.statusDict["onlinestates"][renderRow.onlineStates] }}</el-tag
    >
    <el-tag
      v-if="renderField.prop === 'switchStatus'"
      :type="renderRow.switchStatus ? 'success' : 'danger'"
      >{{ state.statusDict["switchStatus"][renderRow.switchStatus] }}</el-tag
    >
  </div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, inject } from "vue";
import type { TableColumn, TableRow, OptButton } from "@/utils/baTable"; //表格列行类型

const electric = inject("electric") as any;

// BuildAdmin将自动为此组件传递五个Props
interface Props {
  renderValue: any; // 单元格值
  renderRow: TableRow; // 当前行数据
  renderField: TableColumn; // 当前列数据
}

const props = withDefaults(defineProps<Props>(), {});

const state: { statusDict: any } = reactive({
  statusDict: electric.tags,
});

onMounted(() => {
  //   console.log(
  //     "TagVue单元格值",
  //     electric.tags,
  //   );
});
</script>
<style lang="scss" scoped></style>
